<?php 

	Class IndexAction extends Action{

		public function index(){
			$s = M('setting')->find();
			$n = M('content')->limit(5)->order('sort,time desc')->select();
			$xinshou = M('content')->where(array('type'=>1))->limit(8)->select();
			// $this->act = 'class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent"';
			// $this->none = 'class="menu-item menu-item-type-taxonomy menu-item-object-category"';
			$i=1;
			$this->typename = gettypename();
			$this->assign(array('s'=>$s,'news'=>$n,'xinshou'=>$xinshou))->display();
		}

		public function cat(){
			$none = 'menu-item menu-item-type-taxonomy menu-item-object-category';
			$show = 'menu-item menu-item-type-taxonomy menu-item-object-category current-menu-item current_page_item';
			$c = I('c',-1,intval);
			switch ($c) {
				case 1:
					$this->cs0 = $none;
					$this->cs1 = $show;
					$this->cs2 = $none;
					$this->cs3 = $none;
					$this->cs4 = $none;
					break;
				case 2:
					$this->cs0 = $none;
					$this->cs1 = $none;
					$this->cs2 = $show;
					$this->cs3 = $none;
					$this->cs4 = $none;
					break;
				case 3:
					$this->cs0 = $none;
					$this->cs1 = $none;
					$this->cs2 = $none;
					$this->cs3 = $show;
					$this->cs4 = $none;
					break;
				case 4:
					$this->cs0 = $none;
					$this->cs1 = $none;
					$this->cs2 = $none;
					$this->cs3 = $none;
					$this->cs4 = $show;
					break;
				default:
					$this->cs0 = $show;
					$this->cs1 = $none;
					$this->cs2 = $none;
					$this->cs3 = $none;
					$this->cs4 = $none;
					break;
			}
			$s = M('setting')->find();
			$n = M('content')->limit(8)->order('time desc')->select();
			$this->list = M('content')->where(array('type'=>$c))->order('sort,time desc')->select();
			$tt = gettypename();
			$this->typename = gettypename();
			$this->tn = $tt[$c];
			$this->assign(array('s'=>$s,'news'=>$n))->display();
		}

		public function p(){
			$this->s = M('setting')->find();
			$this->news = M('content')->limit(8)->order('time desc')->select();
			$id = I('id',-1,'intval');
			$this->typename = gettypename();
			$p = M('content')->where(array('id'=>$id))->find();
			$this->assign('p',$p)->display();
		}
	}
 ?>